<template>
  <div class="container">
    <el-table :data="tableData" style="width: 100%" :fit='true'>
      <!-- <el-table-column prop="jobName" label="岗位名称" width="140">
      </el-table-column> -->
      <el-table-column label="岗位名称" align="center">
        <template slot-scope="scope">
          <span>{{scope.row.jobOutVo.id&&scope.row.jobOutVo?scope.row.jobOutVo.name:'职位已被删除或不存在'}}</span>
        </template>
      </el-table-column>
      <el-table-column label="企业名称" align="center">
        <template slot-scope="scope">
          <span>{{scope.row.jobOutVo.companyInfo&&scope.row.jobOutVo?scope.row.jobOutVo.companyInfo.name:''}}</span>
        </template>
      </el-table-column>
      <!-- <el-table-column prop="companyName" label="企业名称" width="160">
      </el-table-column> -->
      <el-table-column prop="createTime" label="投递时间" width="160">
      </el-table-column>
      <el-table-column prop="feedbackTime" label="反馈时间" width="160">
      </el-table-column>
      <el-table-column prop="statusText" label="投递结果" width="100">
      </el-table-column>
      <el-table-column prop="feedbackReason" label="反馈原因">
      </el-table-column>
    </el-table>
    <div class="page">
      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
        :current-page="page" :page-sizes="[10, 20, 30, 40]" :page-size="size"
        layout="prev, pager, next, jumper, sizes, total" :total="total">
      </el-pagination>
    </div>
  </div>
</template>

<script>
import { deliverInfo } from '../../../api/personal'
export default {
  name: '',
  props: ['id'],
  data () {
    return {
      tableData: [],
      page: 1,
      size: 10,
      total: 0
    }
  },
  created () {
    this.getList();
  },
  watch: {
    id: function () {
      this.page = 1;
      this.size = 10;
      this.getList();
    }
  },
  methods: {
    handleSizeChange (val) {
      this.size = val
      this.getList();
    },
    handleCurrentChange (val) {
      this.page = val
      this.getList()
    },
    getList () {
      let formData = new FormData;
      formData.append('condition', JSON.stringify([{ "column": "resume_id", "type": "eq", "value": this.id }]));
      formData.append('page', this.page);
      formData.append('size', this.size)
      deliverInfo(formData).then(res => {
        if (res.success) {
          this.tableData = res.data.records || [];
          this.total = res.data.total
        } else {
          this.$message.error(`${res.msg}`)
        }
      })
    }
  }
}
</script>

<style lang="css" scoped>
.container {
    padding: 0;
}
.page {
    margin: 20px 0;
    text-align: center;
}
.el-table /deep/ td,
.el-table /deep/ th {
    text-align: center;
}
</style>